package com.alibaba.citrus.ots.platform.enhance.sdo;

import lombok.Getter;
import lombok.Setter;

import java.util.Arrays;

/**
 * @author zhoubc
 * @description: TODO
 * @date 2021/9/13 21:23
 */
public enum OrganizationTypeEnum {

    GROUP(100,"蒙牛集团"),

    ENTERPRISE_GROUP(101,"事业部"),

    REGION(102,"销售大区"),

    COMPANY(103,"分子公司"),

    SALES_ORGANIZATION(104,"销售组织"),

    SALES_CHANNEL(105,"销售渠道"),

    SALES_DEPARTMENT(106,"销售部门");

    @Getter
    @Setter
    private Integer code;

    @Getter
    @Setter
    private String desc;

    OrganizationTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static OrganizationTypeEnum of(Integer code) {
        if (code == null) {
            return null;
        }
        return Arrays.stream(OrganizationTypeEnum.values()).filter(source -> code.equals(source.code)).findFirst().orElse(null);
    }


}
